<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/loggedTemplate.xhtml">

	<f:metadata>
		<f:event type="preRenderView"
			listener="#{versaoBean.initConversation}" />
	</f:metadata>

	<ui:define name="content">
		<h1 class="formTitle ui-widget-header ui-corner-all">#{msg['versao.titulo.cadastro']}</h1>

		<h:form id="versaoForm">
		
			<p:growl id="messages" />	
		
			<p:panelGrid columns="2" id="panel">
			
				#{msg['versao.numero']}
				<p:inputText value="#{versaoBean.entidade.numero}" id="numero" label="#{msg['versao.numero']}" />
				
				#{msg['versao.dataCriacao']}
				<p:inputText value="#{versaoBean.entidade.dataCriacao}" id="dataCriacao" 
					readonly="true" label="#{msg['versao.dataCriacao']}" />
				
				#{msg['versao.medicosIncluidos']}:
				<p:dataTable var="medico" value="#{versaoBean.medicosIncluidosDataModel}" paginator="true"
					rows="#{medicoBean.pageSize}"
					emptyMessage="#{msg['dataModel.lista.vazia']}"
					paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
					rowsPerPageTemplate="5,10,15" selectionMode="single"
					rowKey="#{medico.id}" selection="#{medicoBean.entidade}" id="medicosIncluidosDataModel"
					lazy="true">

					<p:column headerText="#{msg['medico.nome']}">
						<h:outputText value="#{medico.nome}" />
					</p:column>
	
					<p:column headerText="#{msg['medico.cpf']}">
						<h:outputText value="#{medico.cpf}" />
					</p:column>

				</p:dataTable>
				
				#{msg['versao.medicosRemovidos']}:
				<p:dataTable var="medico" value="#{versaoBean.medicosRemovidosDataModel}" paginator="true"
					rows="#{medicoBean.pageSize}"
					emptyMessage="#{msg['dataModel.lista.vazia']}"
					paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
					rowsPerPageTemplate="5,10,15" selectionMode="single"
					rowKey="#{medico.id}" selection="#{medicoBean.entidade}" id="medicosRemovidosDataModel"
					lazy="true">

					<p:column headerText="#{msg['medico.nome']}">
						<h:outputText value="#{medico.nome}" />
					</p:column>
	
					<p:column headerText="#{msg['medico.cpf']}">
						<h:outputText value="#{medico.cpf}" />
					</p:column>

				</p:dataTable>

			</p:panelGrid>
			
			<div id="buttons" class="ui-widget ui-widget-header">
				<p:commandButton value="#{msg['botao.salvar']}"
					action="#{versaoBean.salvar}" update="versaoForm" ajax="false" />
				<p:commandButton value="#{msg['botao.cancelar']}"
					action="#{versaoBean.cancelar}" immediate="true" />
			</div>
			
		</h:form>
	</ui:define>
	
	
</ui:composition>
